{extend name="layout:base" /}

{block name="content"}
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <form class="layui-form">
                <input type="hidden" name="id" value="{$article.id}">
                <div class="layui-row layui-col-space10 layui-form-item">
                    <div class="layui-col-lg12">
                        <label class="layui-form-label">当前客户：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="username" value="{$article.username}"  disabled class="layui-input">
                        </div>
                        <div class="layui-form-mid layui-word-aux">*用户登录系统帐号</div>
                    </div>
                </div>
                <div class="layui-row layui-col-space10 layui-form-item">
                    <div class="layui-col-lg12">
                        <label class="layui-form-label">销售：</label>
                        <div class="layui-inline">
                            <select name="xs_id" id="xs_id" lay-filter="xs_id">
                                {volist name="xs_list" id="vo"}
                                <option value="{$vo.id}" {eq name="vo.id" value="$article['xs_id']" }selected{/eq}>{$vo.username}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item layui-layout-admin">
                    <div class="layui-input-block">
                        <div class="layui-footer" style="left: 0;">
                            <button class="layui-btn" lay-submit="" lay-filter="btnAdd">保存</button>
                            <a class="layui-btn layui-btn-primary" href="javascript:parent.location.reload();">返回</a>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
{/block}

{block name="script"}
<script>
    layui.config({
        base: '__STATIC__/layuiadmin/' //静态资源所在路径
    }).extend({
        index: '/lib/index' //主入口模块
    }).use(['index', 'table','form','laydate'], function () {
        var $ = layui.$, form = layui.form, layer = layui.layer, table = layui.table, laydate = layui.laydate;

        laydate.render({elem: '#serviceEndTime'});

        form.on('submit(btnAdd)', function (data) {
            $.post("{:url('edit_xs')}", data.field, function (result) {
                if (result['code'] == 0) {
                    layer.msg(result['msg'], {icon: 1, time: 1000}, function () {
                        parent.location.reload();
                    });
                } else {
                    layer.msg(result['msg'], {icon: 3, time: 3000});
                }
            });
            return false;
        });
    });
</script>
{/block}